define(function() {
	"use strict";
	
	var timer = function() {
		var self = this;
		
		var intervalId = null;
		
		self.stop = function() {
			if (intervalId) {
				clearInterval(intervalId);
				intervalId = null;
			}
		};
		
		self.start = function(func, millisec) {
			self.stop();
			intervalId = setInterval(func, millisec);
		};
		
		self.ticking = function() {
			return intervalId;
		};
		
	};
	
	return timer;
});